package create_pattern.factory.simple_factory;

/**
 * @author fly
 * @data 2022-03-29
 */
public class PenFactory {

    //静态工厂方法来获取具体实例
    public static Pen getPen(String pen) {
        if (pen.equals("coloredPen")) {
            return new ColoredPen();
        }
        if (pen.equals("writingBrush")) {
            return new WritingBrush();
        }
        return null;
    }
}